package ui;

import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;

import util.Settings;

/**
 * Move-set menu.
 * @author VincentLy
 */
public class MoveMenu extends BasicGameState{

	private CustomButton back;	
	private String s1 = "Command List";
	private String s2 = "Shoot Bullet - 'J'";
	private String s3 = "Double Bullets - 'SJ'";
	private String s4 = "Triple Bullets - 'SAJ' or 'SDJ'";
	private String s5 = "Bullet Heaven - 'K'";
	private String s6 = "Dash - 'AA' or 'DD'";
	private String s7 = "Platform Drop - 'SS'";
	private float ex,ey = -1;

	public MoveMenu(){
		super();
		back = new CustomButton(Settings.screenX/2-Settings.buttonX/2,Settings.screenY-Settings.buttonY*2,"Back",'b');	 
	}

	/**
	 * Initialization not needed yet.
	 * @author VincentLy
	 */
	public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {}

	/**
	 * Checks to see if the user has finished looking at the move menu.
	 * @author VincentLy
	 */
	public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
		Input i = gc.getInput();
		ex = i.getMouseX();
		ey = i.getMouseY();
		if(back.contains(ex,ey)){
			back.setOn(true);
			if(i.isMousePressed(Input.MOUSE_LEFT_BUTTON))
				sbg.enterState(Settings.prevState);
		}	
		else
			back.setOn(false);		
	}

	/**
	 * Outlines the move details in a list.
	 * @author VincentLy
	 */
	public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
		g.setAntiAlias(true);
		g.setBackground(Settings.bg);
		g.setLineWidth(1);
		g.setColor(Color.white);
		g.drawString(s1,(Settings.screenX-g.getFont().getWidth(s1))/2,g.getFont().getHeight(s1));
		g.drawString(s2,250,150);
		g.drawString(s3,250,200);
		g.drawString(s4,250,250);
		g.drawString(s5,250,300);
		g.drawString(s6,250,350);
		g.drawString(s7,250,400);
		back.draw(g);
	}	

	/**
	 * @return id
	 * @author VincentLy
	 */
	public int getID() {return Settings.mID;}	
}